package com.common.ui;


import android.text.TextUtils;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.common.R;
import com.common.entity.NoteBean;

import java.util.List;

public class NoteGridAdapter extends BaseQuickAdapter<NoteBean, BaseViewHolder> {

    private TextView tvNoteTitle;
    private TextView tvNoteTitle2;
    private TextView tvNoteLastTime;
    private TextView tvNoteContent;

    public NoteGridAdapter(@Nullable List<NoteBean> data) {
        super(R.layout.item_note_grid, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, NoteBean item) {

        tvNoteTitle = (TextView) helper.getView(R.id.tv_note_title);
        tvNoteLastTime = (TextView) helper.getView(R.id.tv_note_last_time);
        tvNoteContent = (TextView) helper.getView(R.id.tv_note_content);
        tvNoteTitle2 = helper.getView(R.id.tv_note_title2);
        tvNoteTitle2.setText(item.getTitle());
        tvNoteTitle.setText(item.getTitle());
        tvNoteContent.setText(item.getContent());
        if (!TextUtils.isEmpty(item.getUpdate_time())) {
            String[] times = item.getUpdate_time().split(" ");
            tvNoteLastTime.setText(times[0]);
        }

    }
}
